<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #outer{
            border: 1px solid #999;
            width: 120px;
            height: 120px;

            /* 外层容器设置成相对定位 */
            position: relative;

            left: 150px;
            top: 100px;
        }
        .error{
            color: red;

            /* 内层容器设置成绝对定位 */
            position: absolute;
            top: 0px;
            right: 0px;
        }
    </style>
</head>
<body>
    <div id="outer">
        <div class="error">×</div>
    </div>
</body> 
</html>